#ifndef TICKETBOOKING_H
#define TICKETBOOKING_H

#include <QWidget>
#include <QElapsedTimer>
QT_BEGIN_NAMESPACE
namespace Ui {
class TicketBooking;
}
QT_END_NAMESPACE

class TicketBooking : public QWidget
{
    Q_OBJECT

public:
    TicketBooking(QWidget *parent = nullptr);
    ~TicketBooking();

    void run();//线程入口函数
private slots:
    void on_startbtn_clicked();

    void on_vipbtn_clicked();

    void on_textBrowser_textChanged();

private:
    Ui::TicketBooking *ui;
    bool isTicketGrabbing{false};//是否在抢票中
    int res{100};//模拟火车票资源
    std::atomic_bool abort{false};//是否中断线程
    std::atomic_int32_t number{1};//助手编号
    std::atomic_bool isvip{false};//是否是vip
    QElapsedTimer elaspedtimer;
    };
#endif // TICKETBOOKING_H
